# # 10
# import json
#
# print(chr(97))
# print(chr(122))
#
# d = {}
# for i in range(26):
#     d[chr(i + 97)] = i + 1
#
# print(d)
# with open('letters.json', 'w') as f:
#     json.dump(d, f)
#
# with open('letters.json', 'r') as f1:
#     d1 = json.load(f1)
#
# print(d1)

# # 11
# import random
#
#
# def shuffle_list(li):
#     n = len(li)
#     for j in range(n):
#         k = random.randint(0, n - 1)
#         li[j], li[k] = li[k], li[j]
#     return li
#
#
# print(shuffle_list([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]))


# # 12
# def my_group(li, k):
#     n = len(li)
#     d, r = divmod(n, k)
#     res = []
#     for i in range(d):
#         res.append(li[i * k:(i + 1) * k])
#     if r > 0:
#         res.append(li[d * k:])
#     return res
#
#
# print(my_group(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'], 5))

# # 12'
# def my_group2(li, k):
#     n = len(li)
#     d, r = divmod(n, k)
#     d1 = d + 1 if r > 0 else d
#     res = []
#     for i in range(d1):
#         res.append(li[i:n:d1])
#     return res
#
# print(my_group2(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n'], 5))

# # 13
# li = [1, 4, 3, 43, 5, 4554, 21, 576, 5, 7, 3, 3, 4654, 5, 4, 357, 65, 7, 79, 653]
# for l in li:
#     if l % 2 == 1:
#         print(l)

# # 14
# d = {'a': 'z', 'b': 'y', 'c': 'x'}
# d1 = {}
# for k, v in d.items():
#     d1[v] = k
# print(d1)

# # 15
# def collatz(n):
#     res = []
#     while n != 1:
#         res.append(n)
#         if n % 2 == 0:
#             n = n // 2
#         else:
#             n = 3 * n + 1
#     res.append(1)
#     return res, len(res)
#
#
# print(collatz(100))

# # 16
# import os
#
# for file in os.listdir('.'):
#     print(file)

# # 17
# import pickle
#
#
# d = {}
# for i in range(26):
#     d[chr(i + 97)] = i + 1
#
# print(d)
# with open('dict.pkl', 'wb') as f:
#     pickle.dump(d, f)

# # 18
# import time
#
# t0 = time.time()
# sum_numbers = 0
# for i in range(1, 100001):
#     sum_numbers += i
# t1 = time.time()
#
# print(t1 - t0)

# 19
import pandas as pd

india = pd.read_csv('covid_19_india.csv')
states = india['State/UnionTerritory'].unique()
print(states)

# 20
import pandas as pd

us = pd.read_csv('us_covid19_daily.csv')
positive_cases = us['positive']
print(positive_cases)

ma_positive = positive_cases.rolling(7).mean()
print(ma_positive)
